package net.aaa.hotel.controller;

import net.aaa.hotel.dao.YGDao;
import net.aaa.hotel.dao.impl.IYGDaoImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;
import java.util.List;
import java.util.Map;

@Controller
public class QuanXianSpringController {
    @Autowired
    private YGDao dao = new IYGDaoImpl();
    @RequestMapping("YGQQQuan")
    public String quanxian(HttpSession session){
        int rid = Integer.parseInt(session.getAttribute("rid") + "");
        List<Map> maps = dao.GetQuanXian(rid);
        for (Map map : maps) {
            List<Map> m = dao.quanEr(rid,map.get("mid"));
            map.put("children",m);
        }
        System.out.println(maps);
        session.setAttribute("quan",maps);
        return "beautyButt/index";
    }
}
